<template>
  <!-- 人员信息 -->
  <div class="container">
    <el-form ref="search" :inline="true" :model="form" :rules="rules" class="search" label-width="100px" size="small">
      <el-form-item label="人员编号:">
        <el-input v-model="form.id" placeholder="请输入人员编号" clearable />
      </el-form-item>
      <el-form-item label="人员姓名:">
        <el-input v-model="form.username" placeholder="请输入人员姓名" />
      </el-form-item>
      <el-form-item label="开始时间:" prop="startTime">
        <el-date-picker v-model="form.startTime" :picker-options="startTime" type="datetime" placeholder="请选择开始时间" />
      </el-form-item>
      <el-form-item label="结束时间:" prop="endTime">
        <el-date-picker v-model="form.endTime" :picker-options="endTime" type="datetime" placeholder="请选择结束时间" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" size="mini" @click="handleSearch">查询</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="tableData" border style="width: 100%" stripe>
      <el-table-column prop="position" label="位置" />
      <el-table-column prop="name" label="设备名称" />
      <el-table-column prop="id" label="人员编号" />
      <el-table-column prop="username" label="人员姓名" />
      <!-- <el-table-column prop="dep" label="人员部门" /> -->
      <el-table-column prop="date" label="时间" />
      <!-- <el-table-column prop="img" label="图片" /> -->
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        id: '',
        username: '',
        startTime: '',
        endTime: ''
      },
      // 开始时间
      startTime: {
        disabledDate: time => {
          if (this.formInline.endTime) {
            return (
              time.getTime() > new Date(this.formInline.endTime).getTime()
            )
          } else {
            return time.getTime() > Date.now()
          }
        }
      },
      // 结束时间
      endTime: {
        disabledDate: time => {
          if (this.formInline.startTime) {
            return (
              time.getTime() > Date.now() ||
              time.getTime() < new Date(this.formInline.startTime).getTime()
            )
          } else {
            return time.getTime() > Date.now()
          }
        }
      },
      // 表格数据
      tableData: [
        {
          position: 'xy',
          name: '1号',
          id: '1',
          username: 'ce',
          dep: '测试',
          date: '2022-01-10',
          img: ''
        },
        {
          position: 'xy',
          name: '1号',
          id: '1',
          username: 'ce',
          dep: '测试',
          date: '2022-01-10',
          img: ''
        },
        {
          position: 'xy',
          name: '1号',
          id: '1',
          username: 'ce',
          dep: '测试',
          date: '2022-01-10',
          img: ''
        }
      ]
    }
  },
  computed: {
    rules() {
      return {
        startTime: [
          { required: true, message: '请选择开始时间', trigger: ['blur'] }
        ],
        endTime: [
          { required: true, message: '请选择结束时间', trigger: ['blur'] }
        ]
      }
    }
  },
  methods: {
    // 查询人员轨迹
    handleSearch() {

    }

  }

}
</script>

<style lang="scss" scoped>
.container {
  padding: 0 17px;
  position: relative;
  .search {
    padding-top: 16px;
  }
  .el-table {
    margin-top: 30px;
  }
  .table-wrap {
    .icon-table {
      margin: 0 10px;
    }
    .table-header {
      height: 52px;
      background: #f6f7f9;
      border: 1px solid #e1e7e9;
      border-bottom: none;
      font-size: 16px;
      color: #494949;
      line-height: 52px;
      border-radius: 4px 4px 0 0;
      .count {
        color: rgb(235, 104, 84);
      }
      .table-control {
        margin-right: 10px;
      }
    }
  }
  .pagination-wrap {
    height: 80px;
    .pagination {
      display: inline-block;
    }
  }
}
</style>

<style lang="scss">
.tree-line {
  .el-tree-node {
    position: relative;
    padding-left: 16px; // 缩进量
  }
  .el-tree-node__children {
    padding-left: 16px; // 缩进量
  }

  // 竖线
  .el-tree-node::before {
    content: '';
    height: 100%;
    width: 1px;
    position: absolute;
    left: -3px;
    top: -26px;
    border-width: 1px;
    border-left: 1px dashed #52627c;
  }
  // 当前层最后一个节点的竖线高度固定
  .el-tree-node:last-child::before {
    height: 38px; // 可以自己调节到合适数值
  }

  // 横线
  .el-tree-node::after {
    content: '';
    width: 24px;
    height: 20px;
    position: absolute;
    left: -3px;
    top: 12px;
    border-width: 1px;
    border-top: 1px dashed #52627c;
  }

  // 去掉最顶层的虚线，放最下面样式才不会被上面的覆盖了
  & > .el-tree-node::after {
    border-top: none;
  }
  & > .el-tree-node::before {
    border-left: none;
  }

  // 展开关闭的icon
  .el-tree-node__expand-icon {
    font-size: 16px;
    // 叶子节点（无子节点）
    &.is-leaf {
      color: transparent;
      // display: none; // 也可以去掉
    }
  }
}
.selDept {
  width: 178px;
  border: 1px solid #eee;
  .el-icon-circle-close {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 10;
    font-size: 18px;
    color: #666;
    cursor: pointer;
  }
}
</style>
